package com.jlcindia;

public class Lab16 {
public static void main(String[] args) {
		A$B ref=null;
		ref=new A$B();
		System.out.println(ref);
		//X$Y ref2=null;
		X.Y ref3=null;
		
		X ref4=new X();
		//ref3=new Y();
		ref3=ref4.new Y();
		ref3=new X().new Y();
		X.Y ref5=new X().new Y();
		System.out.println(ref3);
		System.out.println(ref5);
		System.out.println("\n--------------");
		Hello1.display();
		System.out.println();
		Hello1 he=new Hello1("MSG in MAIN");
		System.out.println("===========");
		System.out.println(he.msg);
		//System.out.println(he.intValue);
		he.show();
		Hello1.JlcInner1 inRef=null;
		inRef=new Hello1("MSG IN MAIN AGAIN").new JlcInner1(6060);
		inRef.showDataInInnerClass();
		inRef=he.new JlcInner1(4040);
		inRef.showDataInInnerClass();
		System.out.println(inRef.intValue);
		//System.out.println(inRef.msg);
}
}
class A$B{}
class B{}
class A{
	//class B{}
}
class X{
	int var=10;
	class Y{}
}
class Y{}
//class X$Y{}
class Hello1{
	static int VAL=9090;
	String msg;
	
	Hello1(String msg){
		this.msg=msg;
	}
	class JlcInner1{	//instance inner class
		//static int stValue=9876;
		final static int CONS=9999;//actually it is a constant
		int intValue;
		public JlcInner1(int intValue){
			this.intValue=intValue;
		}
		void showDataInInnerClass(){
			System.out.println("\n**showData in Inner Class***");
			System.out.println(intValue);
			System.out.println(CONS);
			System.out.println(msg);
			//System.out.println(this.msg);//outer class variable can't be accessed with inner class object
			System.out.println(VAL);
		}
	}
	void show(){
		System.out.println("\n--INSTANCE Show Method");
		System.out.println(VAL);
		System.out.println(msg);
		System.out.println(this.msg);
		JlcInner1 ref=null;
		ref=new JlcInner1(1111);//by default it is like ref=this.new JlcInner1(1111);
		ref=this.new JlcInner1(1111);
		System.out.println(ref.intValue);
		ref.showDataInInnerClass();
	}
	static void display(){
		System.out.println("\n--- StATIC dISPLAY Method--");
		System.out.println(VAL);
		//System.out.println(msg);
		Hello1 ref=new Hello1("MSG in Display");
		System.out.println(ref.msg);
		JlcInner1 ref1=null;
		//ref1=new JlcInner(2222);
		ref1=ref.new JlcInner1(2222);
		ref1.showDataInInnerClass();
		
		}

	}


